package avicit.bdp.dlm.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import avicit.platform6.core.properties.PlatformConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;

/**
 * bdp_dlm_stat实体类
 *
 *
 * @author xugb
 * @date 2020/12/1 9:10
 */
@ApiModel(value = "DlmHiveStatDTO", description = "bdp_dlm_hive_stat")
@Table(name = "bdp_dlm_hive_stat")
public class DlmHiveStatDTO extends BaseDTO {


    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @Id
    @LogField
    @ApiModelProperty(value = "id", name = "id")
    @FieldRemark(column = "id", field = "id", name = "主键")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 统计日期
     */
    @LogField
    @ApiModelProperty(value = "统计日期", name = "statDate")
    @FieldRemark(column = "stat_date", field = "statDate", name = "统计日期")
    @Column(name = "stat_date")
    private String statDate;

    /**
     * 数据源ID
     */
    @LogField
    @ApiModelProperty(value = "数据源ID", name = "dataSourceId")
    @FieldRemark(column = "data_source_id", field = "dataSourceId", name = "数据源ID")
    @Column(name = "data_source_id")
    private String dataSourceId;

    /**
     * 表名
     */
    @LogField
    @ApiModelProperty(value = "表名", name = "tableName")
    @FieldRemark(column = "table_name", field = "tableName", name = "表名")
    @Column(name = "table_name")
    private String tableName;

    /**
     * 表容量
     */
    @LogField
    @ApiModelProperty(value = "表容量", name = "tableAmount")
    @FieldRemark(column = "table_amount", field = "tableAmount", name = "每日增量")
    @Column(name = "table_amount")
    private Long tableAmount;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getStatDate() {
        return statDate;
    }

    public void setStatDate(String statDate) {
        this.statDate = statDate;
    }

    public String getDataSourceId() {
        return dataSourceId;
    }

    public void setDataSourceId(String dataSourceId) {
        this.dataSourceId = dataSourceId;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public Long getTableAmount() {
        return tableAmount;
    }

    public void setTableAmount(Long tableAmount) {
        this.tableAmount = tableAmount;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "数据湖统计模块";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "数据湖hive统计";
        } else {
            return super.logTitle;
        }
    }

    @Override
    public PlatformConstant.LogType getLogType() {
        if (super.logType == null) {
            return PlatformConstant.LogType.module_operate;
        } else {
            return super.logType;
        }
    }

    @Override
    public String toString() {
        return "DlmHiveStatDTO{" +
                "id='" + id + '\'' +
                ", statDate='" + statDate + '\'' +
                ", dataSourceId='" + dataSourceId + '\'' +
                ", tableName='" + tableName + '\'' +
                ", tableAmount=" + tableAmount +
                '}';
    }
}
